#include <graphics/SubSkin.h>

namespace ne
{
    SubSkin::SubSkin(const std::string &name)
        : Object(name)
    {
    }

    size_t SubSkin::getSize() const
    {
        if (mpSubMesh.notNull())
        {
            return mpSubMesh->getSize();
        }
        return 0;
    }

    void SubSkin::setSubMesh(const SubMeshPtr &pSubMesh)
    {
        mpSubMesh = pSubMesh;
        mpMaterial.setNull();
        if (pSubMesh.notNull())
        {
            mpMaterial = pSubMesh->getMaterial();
        }
    }

    SubMeshPtr SubSkin::getSubMesh() const
    {
        return mpSubMesh;
    }

    void SubSkin::setIndexData(const IndexDataPtr &pIndexData)
    {
        if (mpSubMesh.notNull())
        {
            mpSubMesh->setIndexData(pIndexData);
        }
    }

    IndexDataPtr SubSkin::getIndexData() const
    {
        if (mpSubMesh.notNull())
        {
            return mpSubMesh->getIndexData();
        }
        return IndexDataPtr();
    }

    void SubSkin::setMaterial(const MaterialPtr &pMaterial)
    {
        mpMaterial = pMaterial;
    }

    MaterialPtr SubSkin::getMaterial() const
    {
        return mpMaterial;
    }

    SubSkin::~SubSkin()
    {
    }
}
